// 获取变量类型
export const getValueType = value => {
    return Object.prototype.toString.call(value).replace(/^\[object (\S+)\]$/, '$1');
};

// 设置默认值
export const resetField = value => {
    const typeDefaultValMap = {
        Array: [],
        String: '',
        Object: {},
        Boolean: false,
        Null: null
    };
    const valueType = getValueType(value);
    return typeDefaultValMap[valueType] ? typeDefaultValMap[valueType] : undefined;
};
